
$(document).on('click',".mainpagebutton", function() {
  var name = this.name;
  callPage(name); 
  //$('.dropdown-toggle').dropdown();
});

function callPage(page){

	$.ajax({
	  type: "GET",
	  url: "./" + page + ".php",
	  success: function(data) {
	    $("#content").html(data);
	  }
	  }) 
};


$(document).on("click","#logout", function(){
    $.ajax({
      type: "POST",
      data: { logout: 1 },
      url: "./logout.php",
      success: function(data) {
        $("#content").html(data);
      },
      error: function(xhr, status, error){
        alert(xhr.responseText);
      }
    });
    return false;
});

$(document).on("click",'ul li', function(){
    $(this).addClass('active').siblings().removeClass('active');
  });


$(document).on("click",'.dropdown', function(){
 $('.dropdown-toggle').dropdown();
});

$(document).on("click", function(){
    //$('.dropdown-toggle').dropdown();    
});

$(function(){
	$('#mytab').tabCollapse();
 $('.dropdown-toggle').dropdown();
});

$(document).on('click','.navbar-collapse', function(c) {
	if( $(c.target).is('a') && ( $(c.target).attr('class') != 'dropdown-toggle' ) ) {
        $(this).collapse('hide');
   }
});



